Trees | Indices | Toggle frames |
---|
event.EventDispatcher --+ | Sprite
Instance of an on-screen image.
See the module documentation for usage.
on_animation_end(self)
The sprite animation reached the final frame.
|
__init__(self,
img,
x=0,
y=0,
blend_src=770,
blend_dest=771,
batch=None,
group=None,
usage=' dynamic ' )
Create a sprite.
|
|
__del__(self) | |
delete(self)
Force immediate removal of the sprite from video memory.
|
|
set_position(self,
x,
y)
Set the X and Y coordinates of the sprite simultaneously.
|
|
draw(self)
Draw the sprite at its current position.
|
|
dispatch_event(self,
event_type,
*args)
Dispatch a single event to the attached handlers.
(Inherited from pyglet.event.EventDispatcher)
|
|
event(self,
*args)
Function decorator for an event handler.
(Inherited from pyglet.event.EventDispatcher)
|
|
pop_handlers(self)
Pop the top level of event handlers off the stack.
(Inherited from pyglet.event.EventDispatcher)
|
|
push_handlers(self,
*args,
**kwargs)
Push a level onto the top of the handler stack, then attach zero or
more event handlers.
(Inherited from pyglet.event.EventDispatcher)
|
|
register_event_type(cls,
name)
Register an event type with the dispatcher.
(Inherited from pyglet.event.EventDispatcher)
|
|
remove_handler(self,
name,
handler)
Remove a single event handler.
(Inherited from pyglet.event.EventDispatcher)
|
|
remove_handlers(self,
*args,
**kwargs)
Remove event handlers from the event stack.
(Inherited from pyglet.event.EventDispatcher)
|
|
set_handler(self,
name,
handler)
Attach a single event handler.
(Inherited from pyglet.event.EventDispatcher)
|
|
set_handlers(self,
*args,
**kwargs)
Attach one or more event handlers to the top level of the handler
stack.
(Inherited from pyglet.event.EventDispatcher)
|
Batch |
batch
Graphics batch.
|
Group |
group
Parent graphics group.
|
AbstractImage or Animation |
image
Image or animation to display.
|
(int, int) |
position
The (x, y) coordinates of the sprite.
|
int |
x
X coordinate of the sprite.
|
int |
y
Y coordinate of the sprite.
|
float |
rotation
Clockwise rotation of the sprite, in degrees.
|
float |
scale
Scaling factor.
|
int |
width
Scaled width of the sprite.
|
int |
height
Scaled height of the sprite.
|
int |
opacity
Blend opacity.
|
(int, int, int) |
color
Blend color.
|
visible |
event_types =
|
The sprite animation reached the final frame.
The event is triggered only if the sprite has an animation, not an image. For looping animations, the event is triggered each time the animation loops.
'
dynamic
'
)
Force immediate removal of the sprite from video memory.
This is often necessary when using batches, as the Python garbage collector will not necessarily call the finalizer as soon as the sprite is garbage.
Draw the sprite at its current position.
See the module documentation for hints on drawing multiple sprites efficiently.
Graphics batch.
The sprite can be migrated from one batch to another, or removed from its batch (for individual drawing). Note that this can be an expensive operation.
Parent graphics group.
The sprite can change its rendering group, however this can be an expensive operation.
Clockwise rotation of the sprite, in degrees.
The sprite image will be rotated about its image's (anchor_x, anchor_y) position.
Scaling factor.
A scaling factor of 1 (the default) has no effect. A scale of 2 will draw the sprite at twice the native size of its image.
Scaled width of the sprite.
Read-only. Invariant under rotation.
Scaled height of the sprite.
Read-only. Invariant under rotation.
Blend opacity.
This property sets the alpha component of the colour of the sprite's vertices. With the default blend mode (see the constructor), this allows the sprite to be drawn with fractional opacity, blending with the background.
An opacity of 255 (the default) has no effect. An opacity of 128 will make the sprite appear translucent.
Blend color.
This property sets the color of the sprite's vertices. This allows the sprite to be drawn with a color tint.
The color is specified as an RGB tuple of integers (red, green, blue). Each color component must be in the range 0 (dark) to 255 (saturated).
Trees | Indices | Toggle frames |
---|
Generated by Epydoc 3.0beta1 on Thu Dec 31 17:58:19 2009 | http://epydoc.sourceforge.net |